# -*- coding: utf-8 -*-
"""
Created on Tue May 14 17:36:06 2024

@author: 29865
"""

import pandas as pd
import matplotlib.pyplot as plt
path = '一、车次上车人数统计表.xlsx'
data = pd.read_excel(path)
D02 = data.loc[data['车次'] == 'D02', ['日期', '上车人数']].sort_values('日期')
D03 = data.loc[data['车次'] == 'D03', ['日期', '上车人数']].sort_values('日期')

# 设置表格基础外观信息
plt.xticks([1,2], ['D02','D03'], rotation = 0) 
plt.title('D02、D03车次上车人数箱线图')
plt.ylabel('上车人数')
plt.xlabel('车次')


# 获取x轴和y轴的值，并绘制柱状图
x = D02['日期'].astype(str)
y_d02 = D02['上车人数']
y_d03 = D03['上车人数']

plt.boxplot([y_d02,y_d03])
